/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package br.siagefi.model;

import br.siagefi.interfaces.BaseEntity;
import java.io.Serializable;
import java.util.Calendar;
import java.util.Objects;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author NOTE
 */
@Entity
@Table(name = "nota_fiscal")
public class NotaFiscal implements Serializable, BaseEntity{

    @Id @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;
    
    @Column(name = "numero", length = 10)
    private int numero;
    
    @Temporal(TemporalType.DATE)
    @Column(name = "data_emissao")
    private Calendar dataEmissao = Calendar.getInstance();
    
    @Column(name = "valor_bruto")
    private double valorBruto;
    
    @Column(name = "retencao")
    private double retencao;
    
    @Column(name = "aliquota_imposto_unico")
    private double aliquotaImpostoUnico;
    
    @Column(name = "descricao", length = 50)
    private String descricao;
    
    @ManyToOne
    private TipoNotaFiscal tipoNotaFiscal;
    

    public NotaFiscal() {
    }
    
    @Override
    public Long getId() {
        return id;
    }

    public int getNumero() {
        return numero;
    }

    public void setNumero(int numero) {
        this.numero = numero;
    }

    public Calendar getDataEmissao() {
        return dataEmissao;
    }

    public void setDataEmissao(Calendar dataEmissao) {
        this.dataEmissao = dataEmissao;
    }

    public double getValorBruto() {
        return valorBruto;
    }

    public void setValorBruto(double valorBruto) {
        this.valorBruto = valorBruto;
    }

    public double getRetencao() {
        return retencao;
    }

    public void setRetencao(double retencao) {
        this.retencao = retencao;
    }

    public double getAliquotaImpostoUnico() {
        return aliquotaImpostoUnico;
    }

    public void setAliquotaImpostoUnico(double aliquotaImpostoUnico) {
        this.aliquotaImpostoUnico = aliquotaImpostoUnico;
    }

    public String getDescricao() {
        return descricao;
    }

    public void setDescricao(String descricao) {
        this.descricao = descricao;
    }

    public TipoNotaFiscal getTipoNotaFiscal() {
        return tipoNotaFiscal;
    }

    public void setTipoNotaFiscal(TipoNotaFiscal tipoNotaFiscal) {
        this.tipoNotaFiscal = tipoNotaFiscal;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 29 * hash + Objects.hashCode(this.id);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final NotaFiscal other = (NotaFiscal) obj;
        if (!Objects.equals(this.id, other.id)) {
            return false;
        }
        return true;
    }
    
}
